<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.sailorj.medical.domain.family_member.Family_member" %>
<%@ page import="com.sailorj.medical.domain.join_nh.Join_nh" %>
<%@ page import="com.sailorj.medical.domain.chronicdis.Chronicdis" %>
<%@ page import="com.sailorj.medical.domain.bx_record.BX_record" %>
<%@ page import="com.sailorj.medical.domain.area.Area" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="/common/base.jsp"%>
<% 
  //实例化AreaDao
  Family_memberDAO family_memberDAO=new Family_memberDAO();
  Join_nhDao join_nhDao=new Join_nhDao();
  ChronicdisDao chronicdisDao=new ChronicdisDao();
  List<Family_member> familyList=family_memberDAO.findByKeyValue("null", null);
  List<Join_nh> familyJoin_nhList=join_nhDao.findFamilyJoin_nhList();
  List<Chronicdis> chronicdisList=chronicdisDao.findByKeyValue("null", null);
  
  //实例化AreaDao
  AreaDao areaDao=new AreaDao();
  int[]grades={1,2,3,4,5,6,7,8,9};
  List<Area> areaList=areaDao.findListByGrade(grades);
%>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<base href="<%=basePath%>">

<title>家庭档案信息列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<link rel="stylesheet" href="css/styles.css">
<link rel="stylesheet" href="css/admin.css">
<script src="js/jquery-1.4.4.min.js"></script>
<script src="js/admin.js"></script>
<link rel="stylesheet" href="other/layui/css/layui.css">
<script src="other/layui/layui.all.js"></script>
</head>

<script type="text/javascript">
    function getkey(a) {
        var IDcard = document.getElementById("IDcard").value;
 		var Illcode = document.getElementById("Illcode").value;
 		var areacode = document.getElementById("areacode").value;
 		
 		var startTime = document.getElementById("startTime").value;
 		var endTime = document.getElementById("endTime").value;
  a.href = '<%=path%>/biz/BX_recordServlet?m=findByLike&IDcard=' + IDcard+'&Illcode='+Illcode+'&areacode='+areacode +'&startTime='+startTime+'&endTime='+endTime;
  }
</script>

<body>
	<form method="post" action="" id="listform">
		<div class="panel admin-panel">
			<div class="panel-head">
				<strong class="icon-reorder">家庭档案信息列表</strong>
			</div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left:10px;">
					<li><a class="button border-main icon-plus-square-o"
						href="<%=path%>/biz/BX_recordServlet?m=input"> 添加家庭档案信息</a></li>
					<input type="text" placeholder="姓名" name="IDcard" id="IDcard"
						class="input" style="width:190px; line-height:17px;display:inline-block" list="family"/> 
						<datalist id="family" class="selectDate" aria-invalid="false"> 
							<%
						  for(Family_member m:familyList){ 
						
						  %>
							<option value="<%=m.getIDcard()%>"><%=m.getMembername()%></option>
							<%} %>

						</datalist >
						<input type="text" placeholder="慢病名称" name="Illcode" id="Illcode"
						class="input" style="width:110px; line-height:17px;display:inline-block" list="Ill"/> 
						<datalist id="Ill" class="selectDate" aria-invalid="false"> 
				
						<%
						  for(Chronicdis m:chronicdisList){ 
						
						  %>
							<option value="<%=m.getIllcode()%>"><%=m.getIllname()%></option>
							<%} %>
						</datalist >
						<input type="text" placeholder="请输入行政区域" name="areacode" id="areacode"
						class="input" style="width:190px; line-height:17px;display:inline-block" list="area"/> 
						<datalist id="area" class="selectDate" aria-invalid="false"> 
							<%
						  for(Area m:areaList){ 
						
						  %>
							<option value="<%=m.getAreacode()%>" ><%=m.getAreaname() %></option>
							<%} %>

						</datalist >

			<div class="layui-inline">
				<label class="layui-form-label">日期</label>
				<div class="layui-input-inline">
					<input type="text" name="startTime" id="startTime" lay-verify="startTime"
						placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
				</div>
			</div>
			至
			<div class="layui-inline">
				
				<div class="layui-input-inline">
					<input type="text" name="endTime" id="endTime" lay-verify="endTime"
						placeholder="yyyy-MM-dd" autocomplete="off" class="layui-input">
				</div>
			</div>

						<a href="" onclick="getkey(this)" 
						class="button border-main icon-search"
						onclick="changesearch()"> 搜索</a>

					<a href="<%=path%>/biz/BX_recordServlet?m=outexcel"
					   class="button border-green icon-search" > 导出Excel</a>
						</li>
				</ul>
				</form>
			</div>
			<table class="table table-hover text-center">
				<tr>	<th width="50">序号</th>
					<th width="20" style="text-align:center;">&nbsp;</th>
					<th>行政区域</th>
					<th>报销记录编码</th>
					
					<th>姓名</th>
					<th>慢性病名称</th>
					<th>总费用</th>
					<th>封顶线</th>
					<th>报销金额</th>
					<th>就诊时间</th>
					<th>报销时间</th>
					
					<th>就诊机构</th>
					<th>报销状态</th>
					<th>经办人</th>
				</tr>
				<%
					String pageNo = request.getParameter("pageNo");
					int p = pageNo == null ? 1 : Integer.parseInt(pageNo);
					BX_recordDao dao = new BX_recordDao();
					String sql = "select * from t_bx_record where 1=1 ";
					Object[] params = {};
					Page pageBean = dao.queryOjectsByPage(sql, params, p,
							Constant.ROW);
				%>
				<%
					for (int i = 0; i < pageBean.getDatas().size(); i++) {

						BX_record model= (BX_record) pageBean.getDatas().get(i);
						
				%>
				<tr>
				<td><%=(i+1) %></td>
					<td><input type="checkbox" name="ids"
						value="<%=model.getArea().getAreacode()%>" /></td>
					<td><%=model.getArea().getAreaname() %></td>
					<td><%=model.getBx_record_code() %></td>
					<td><%=model.getFamily_member().getMembername() %></td>
					<td><%=model.getChronicdis().getIllname()%></td>
					<td><%=model.getAll_cost()%></td>
					<td><%=model.getPolicy().getMax_line()%></td>
					<td><%=model.getBx_cost() %></td>
					
					
					<td><%=model.getVis_time() %></td>
					<td><%=model.getBx_time()%></td>
					<td><%=model.getMedical().getJgmc() %></td>
					<td>
					<c:if test="<%=model.getBx_state() ==1%>"><p style="color: green;">报销成功</p></c:if>
					<c:if test="<%=model.getBx_state() ==0%>">
						<a class="button border-red" href="<%=path%>/biz/BX_recordServlet?m=sign&id=<%=model.getBx_record_code()%>">
							<span class="icon-plus-square-o"></span>签字确认</a>
					</c:if>
					</td>
					<td><%=model.getUser_id() %></td>
					
				</tr>
				<%
					}
				%>
			</table>
			<div class="pagelist">
				<%
					if (pageBean.hasPre()) {
				%>
				<a
					href="<%=path%>/biz/FamilyServlet?m=list&pageNo=<%=pageBean.prePage()%>">上一页</a>
				<%
					} else {
				%>
				<a href="javascript:void(0)">上一页</a>
				<%
					}
				%>
				<%
					List<Integer> linkNums = pageBean.linkLumbers();
					for (int num : linkNums) {
					if (pageBean.isCurrent(num)) {
				%>
				<span class="current"><%=num%></span>
				<%
					} else {
				%>
				<a href="<%=path%>/biz/FamilyServlet?m=list&pageNo=<%=num%>"><%=num%></a>
				<%
					}
					}
				%>
				<%
					if (pageBean.hasNext()) {
				%>
				<a
					href="<%=path%>/biz/FamilyServlet?m=list&pageNo=<%=pageBean.lastPage()%>">下一页</a>
				<%
					} else {
				%>
				<a href="javascript:void(0)">下一页</a>
				<%
					}
				%>
				<a
					href="<%=path%>/biz/FamilyServlet?m=list&pageNo=<%=pageBean.getPages()%>">尾页</a>
			</div>
		</div>
	</form>
<!-- 以下是时间控件 -->
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  //执行一个laydate实例
  laydate.render({
    elem: '#startTime' //指定元素
    ,value: '${tbPoltVote.votestartTime}'
    ,type: 'datetime',
    isInitValue: true
  });
});
</script>
<script>
layui.use('laydate', function(){
  var laydate = layui.laydate;
  
  //执行一个laydate实例
  laydate.render({
    elem: '#endTime' //指定元素
    ,value: '${tbPoltVote.voteendTime}'
    ,type: 'datetime'
    ,isInitValue: true
  });
});
</script>
</body>
</html>
